package com.huohuo.springdemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class SpringDemoApplication {

	public static void main(String[] args) {

		ApplicationContext applicationContext = SpringApplication.run(SpringDemoApplication.class, args);
		String [] contextBeans = applicationContext.getBeanDefinitionNames();
		System.out.println("打印所有的bean对象："+contextBeans.toString());
		//获取bean对象
		Object object  = applicationContext.getBean( "productFactoryBean" );
		System.out.println("获取bean对象:"+object.getClass());

		//获取工厂bean 本身
		Object object4 = applicationContext.getBean( "&productFactoryBean" );
		System.out.println("获取工厂bean 本身:"+object4);

	}

}
